package templatefunc

import (
	"strconv"
	"time"
)

func todate(t interface{}) string {
	var tt int64
	switch t.(type) {
	case string:
		tt, _ = strconv.ParseInt(t.(string), 10, 0)
	case int:
		tt = int64(t.(int))
	case int16:
		tt = int64(t.(int16))
	case int8:
		tt = int64(t.(int8))
	}
	tm := time.Unix(tt, 0)
	return tm.Format("2006-01-02 15:04:05")
}
